<?php
declare(strict_types=1);

namespace App\One;

use App\Controller;
use Field\OneCampaignGroupConst;

// hook controller_one_search_campaign_group_use.php

/**
 * @title   计划组
 * @auth    true
 * @login   true
 * @menu    false
 * @component   vlist/index.vue
 * @icon    el-icon-menu
 * @active  true
 * @affix   false
 * @rank    99
 */
class Crowd extends Controller
{
    // hook controller_one_search_campaign_group_public_start.php


    // hook controller_one_search_campaign_group_public_end.php

    /**
     * @title  下发配置
     * @rank    0
     */
    public function action_Conf_PUT()
    {
        // hook controller_one_search_campaign_group_conf_start.php
        $conf = ['groupTotalRow'=>'bottom','grandTotalRow'=>'bottom','pageSize' => 10000, 'remoteSort' => 0, 'remoteFilter' => 0, 'remoteSummary' => 0, 'hidePagination' => 1, 'hideRefresh' => 0, 'hideDo' => 0, 'add' => 0, 'start' => 0, 'stop' => 0, 'delete' => 0, 'import' => 0, 'export' => 0, 'pageSizes' => [10, 20, 25, 50, 100, 500, 1000, 10000], 'TreeData' => 0, 'Local' => 1, 'enable' => 0, 'disable' => 0, 'chartRange' => 0, 'copy' => 0,
            'merge'=>[
                'CampaignGroup'=>['k'=>'campaignGroupId','v'=>'campaignGroupName'],
                'Campaign'=>['k'=>'campaignId','v'=>'campaignName'],
            ]];
        $Columns = [
            ['prop' => 'campaignGroupName', 'label' => '计划组', 'hidden' => 0, 'sortable' => 1,'pinned'=>'left'],
            ['prop' => 'campaignName', 'label' => '计划', 'hidden' => 0, 'sortable' => 1,'pinned'=>'left'],
            ['prop' => 'adgroupName', 'label' => '主体', 'hidden' => 0,  'sortable' => 1,'pinned'=>'left'],
            ['prop' => 'crowdName', 'label' => '人群', 'hidden' => 0,  'sortable' => 1,'pinned'=>'left'],
            ['prop'=>'campaignGroupId','label'=>'计划组ID','hidden'=>0,'sortable'=>1],
            ['prop'=>'campaignId','label'=>'计划ID','hidden'=>0,'sortable'=>1],
            ['prop' => 'adgroupId', 'label' => '主体ID', 'hidden' => 0,  'sortable' => 1],
        ];
        array_push($Columns,...$this->public_columns) ;
        $Filter = [];
        $Tools = [];

        // hook controller_one_search_campaign_group_conf_end.php
        $this->response('0000', ['Conf' => $conf, 'Filter' => $Filter, 'Tools' => $Tools, 'Columns' => $Columns]);
    }


    /**
     * @title  下发人群修出价价配置
     * @rank    0
     */
    public function action_Price_PUT()
    {
        $BizCode = $this->request->param('BizCode', '');
        $data = [
            [
                'span' => 24,
                'formItems' => [
                    ['prop' => 'mode', 'label' => '出价方式', 'span' => 20, 'component' => 'radioGroup', 'options' => ['all' => 0, 'items' => ['custom' => '指定出价', 'current' => '当前出价', 'market' => '建议出价', 'industry' => '行业均价']]],
                    ['prop' => 'bidType', 'label' => '调整方式', 'span' => 20, 'component' => 'radioGroup', 'options' => ['all' => 0, 'parent' => 'mode', 'items' => [
                        'current' => ['quantity' => '按数值', 'rate' => '按百分比'],
                        'market' => ['quantity' => '按数值', 'rate' => '按百分比'],
                        'industry' => ['quantity' => '按数值', 'rate' => '按百分比'],
                    ]]],
                    ['prop' => 'num', 'label' => '指定数值', 'span' => 10, 'component' => 'input',],
                    ['prop' => 'demo', 'label' => '操作说明', 'span' => 24, 'component' => 'text', 'valueGetter' => 'data.map(row => row["campaignGroupName"]).join("\r\n")',],
                ]
            ],
        ];
        $config = [

        ];
        $this->response('0000', ['BizCode' => $BizCode, 'data' => $data, 'config' => $config]);
    }

    /**
     * @title  下发人群修改溢价配置
     * @rank    0
     */
    public function action_Discount_PUT()
    {
        $BizCode = $this->request->param('BizCode', '');
        $data = [
            [
                'span' => 24,
                'formItems' => [
                    ['prop' => 'mode', 'label' => '出价方式', 'span' => 20, 'component' => 'radioGroup', 'options' => ['all' => 0, 'items' => ['custom' => '指定溢价', 'current' => '当前溢价', 'market' => '建议溢价']]],
                    ['prop' => 'bidType', 'label' => '调整方式', 'span' => 20, 'component' => 'radioGroup', 'options' => ['all' => 0, 'parent' => 'mode', 'items' => [
                        'current' => ['quantity' => '按数值', 'rate' => '按百分比'],
                        'market' => ['quantity' => '按数值', 'rate' => '按百分比'],
                    ]]],
                    ['prop' => 'num', 'label' => '指定数值', 'span' => 10, 'component' => 'input',],
                    ['prop' => 'demo', 'label' => '操作说明', 'span' => 24, 'component' => 'text', 'valueGetter' => 'data.map(row => row["campaignGroupName"]).join("\r\n")',],
                ]
            ],
        ];
        $config = [

        ];
        $this->response('0000', ['BizCode' => $BizCode, 'data' => $data, 'config' => $config]);
    }

    /**
     * @title  下发启停配置
     * @rank    0
     */
    public function action_Status_PUT()
    {
        $BizCode = $this->request->param('BizCode', '');
        $data = [
            [
                'span' => 24,
                'formItems' => [
                    ['prop' => 'way', 'label' => '出价方式', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'items' => ['custom' => '指定限额', 'current' => '当前限额']]],
                    ['prop' => 'bidType', 'label' => '调整类型', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'parent' => 'way', 'items' => [
                        'custom' => ['appoint' => '按数值'],
                        'current' => ['compute' => '按数值', 'rate' => '按百分比'],
                    ]]],
                    ['prop' => 'computemode', 'label' => '计算方式', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'parent' => 'bidType', 'items' => [
                        'appoint' => ['quantity' => '指定'],
                        'compute' => ['add' => '提高', 'sub' => '降低'],
                        'rate' => ['add' => '提高', 'sub' => '降低'],
                    ]]],
                    ['prop' => 'num', 'label' => '数值', 'span' => 12, 'component' => 'input',],
                ]
            ],
        ];
        $config = [

        ];
        $this->response('0000', ['BizCode' => $BizCode, 'data' => $data, 'config' => $config]);
    }

    /**
     * @title  下发关键词人群配置
     * @rank    0
     */
    public function action_Keyword_PUT()
    {
        $BizCode = $this->request->param('BizCode', '');
        $data = [
            [
                'span' => 24,
                'formItems' => [
                    ['prop' => 'way', 'label' => '出价方式', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'items' => ['custom' => '指定限额', 'current' => '当前限额']]],
                    ['prop' => 'bidType', 'label' => '调整类型', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'parent' => 'way', 'items' => [
                        'custom' => ['appoint' => '按数值'],
                        'current' => ['compute' => '按数值', 'rate' => '按百分比'],
                    ]]],
                    ['prop' => 'computemode', 'label' => '计算方式', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'parent' => 'bidType', 'items' => [
                        'appoint' => ['quantity' => '指定'],
                        'compute' => ['add' => '提高', 'sub' => '降低'],
                        'rate' => ['add' => '提高', 'sub' => '降低'],
                    ]]],
                    ['prop' => 'num', 'label' => '数值', 'span' => 12, 'component' => 'input',],
                ]
            ],
        ];
        $config = [

        ];
        $this->response('0000', ['BizCode' => $BizCode, 'data' => $data, 'config' => $config]);
    }
     /**
     * @title  下发达摩盘人群配置
     * @rank    0
     */
    public function action_Dmp_PUT()
    {
        $BizCode = $this->request->param('BizCode', '');
        $data = [
            [
                'span' => 24,
                'formItems' => [
                    ['prop' => 'way', 'label' => '出价方式', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'items' => ['custom' => '指定限额', 'current' => '当前限额']]],
                    ['prop' => 'bidType', 'label' => '调整类型', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'parent' => 'way', 'items' => [
                        'custom' => ['appoint' => '按数值'],
                        'current' => ['compute' => '按数值', 'rate' => '按百分比'],
                    ]]],
                    ['prop' => 'computemode', 'label' => '计算方式', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'parent' => 'bidType', 'items' => [
                        'appoint' => ['quantity' => '指定'],
                        'compute' => ['add' => '提高', 'sub' => '降低'],
                        'rate' => ['add' => '提高', 'sub' => '降低'],
                    ]]],
                    ['prop' => 'num', 'label' => '数值', 'span' => 12, 'component' => 'input',],
                ]
            ],
        ];
        $config = [

        ];
        $this->response('0000', ['BizCode' => $BizCode, 'data' => $data, 'config' => $config]);
    }

    /**
     * @title  下发小二推荐人群配置
     * @rank    0
     */
    public function action_Suggest_PUT()
    {
        $BizCode = $this->request->param('BizCode', '');
        $data = [
            [
                'span' => 24,
                'formItems' => [
                    ['prop' => 'way', 'label' => '出价方式', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'items' => ['custom' => '指定限额', 'current' => '当前限额']]],
                    ['prop' => 'bidType', 'label' => '调整类型', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'parent' => 'way', 'items' => [
                        'custom' => ['appoint' => '按数值'],
                        'current' => ['compute' => '按数值', 'rate' => '按百分比'],
                    ]]],
                    ['prop' => 'computemode', 'label' => '计算方式', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'parent' => 'bidType', 'items' => [
                        'appoint' => ['quantity' => '指定'],
                        'compute' => ['add' => '提高', 'sub' => '降低'],
                        'rate' => ['add' => '提高', 'sub' => '降低'],
                    ]]],
                    ['prop' => 'num', 'label' => '数值', 'span' => 12, 'component' => 'input',],
                ]
            ],
        ];
        $config = [

        ];
        $this->response('0000', ['BizCode' => $BizCode, 'data' => $data, 'config' => $config]);
    }
   /**
     * @title  下发复制人群配置
     * @rank    0
     */
    public function action_Copy_PUT()
    {
        $BizCode = $this->request->param('BizCode', '');
        $data = [
            [
                'span' => 24,
                'formItems' => [
                    ['prop' => 'way', 'label' => '出价方式', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'items' => ['custom' => '指定限额', 'current' => '当前限额']]],
                    ['prop' => 'bidType', 'label' => '调整类型', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'parent' => 'way', 'items' => [
                        'custom' => ['appoint' => '按数值'],
                        'current' => ['compute' => '按数值', 'rate' => '按百分比'],
                    ]]],
                    ['prop' => 'computemode', 'label' => '计算方式', 'span' => 12, 'component' => 'radioGroup', 'options' => ['all' => 0, 'parent' => 'bidType', 'items' => [
                        'appoint' => ['quantity' => '指定'],
                        'compute' => ['add' => '提高', 'sub' => '降低'],
                        'rate' => ['add' => '提高', 'sub' => '降低'],
                    ]]],
                    ['prop' => 'num', 'label' => '数值', 'span' => 12, 'component' => 'input',],
                ]
            ],
        ];
        $config = [

        ];
        $this->response('0000', ['BizCode' => $BizCode, 'data' => $data, 'config' => $config]);
    }

    // hook controller_one_search_campaign_group_end.php
}

?>